package nio;

import java.nio.IntBuffer;

/**
 * @Author Klys
 * @Date 2023/6/3 16:22
 * @Description
 * @Version 1.0
 */
public class Demo13 {


    //缓冲区比较

    public static void main(String[] args) {
        IntBuffer buffer1 = IntBuffer.wrap(new int[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 0});
        IntBuffer buffer2 = IntBuffer.wrap(new int[]{6, 5, 4, 3, 2, 1, 7, 8, 9, 0});
        System.out.println(buffer1.equals(buffer2));   //直接比较

        buffer1.position(6);
        buffer2.position(6);
        System.out.println(buffer1.equals(buffer2));   //比较从下标6开始的剩余内容
    }
}
